home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: Can't install event handlers
- Sent: 3/4/96 6:52 PM
- Received: 3/4/96 6:20 PM
- From: Greg Friedman, friedman@cognosis.com
- Reply-To: ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- Mark Lanett, a quality engineer on our team, came to me with a suspicion of
- what the problem might be. We looked into it, and can explain the behavior
- described.
-
- The ODUtils project that ships with ODF is built with PowerPC alignment on.
- This has the effect of padding fields in structs to longword boundaries.
- SIHelper.cpp declares two structures that, when compiled using 68k
- alignment, are 10 bytes in size. When compiled using PPC alignment, these
- structures grow in size to 12 bytes. This causes a problem because of the
- following line that appears in the method SIHashTable::Initialize in the
- file SIHshTlb.cpp:
-
- if ( valueSize > kMaxValueSize )
- THROW( kODErrHashValueSizeTooBig );
-
- kMaxValueSize is defined, in SIHshTbl.cpp as follows:
-
- #define kMaxValueSize 10
-
- Compiling with PPC alignment pushes the size of the value structures above
- 10 bytes, causing an exception to get thrown, and the tables are never
- created.
-
- There is a chance that the 10 byte limitation is an historical relic and is
- no longer necessary. I'm not willing to suggest you remove it, though. An
- alternative approach is to force the problem structures to be compiled
- using 68k alignment. This involves bracketing the declarations of the two
- structs in SIHelper.cpp as follows:
-
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- struct SIGenericValue
- {
- UniversalProcPtr handler;
- ODSLong refCon;
- ODBoolean fromTypeIsDesc;
- };
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- struct SICoercionHandlerValue
- {
- ODCoercionHandlerUPP handler;
- ODSLong refCon;
- ODBoolean fromTypeIsDesc;
- };
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- I've made the above changes to the version of SIHelper.cpp that we will
- ship with ODF 1. I'm also filing a bug against OpenDoc.
-
- gsf.
-
-
-
- ___________________________________________________________
- Greg Friedman ODF Engineering
- Apple Computer
-
-